package npu.dce.andcontact1;

public class UpdatePacket {

    /*** The length of the data. ***/
    int _length;

    byte[] update_packet = new byte[1920];
         
    int intVersion;
    int intTypes1, intTypes2;
    int intOwner;
	int intGivenName1, intGivenName2, intGivenName3;
	int intMiddleName1, intMiddleName2;
	int intFamilyName1, intFamilyName2, intFamilyName3;
	int intGender;
	int intSpinPhone1, intSpinPhone2;
	int intPhone1, intPhone2, intPhone3, intPhone4;
	int intSpinEmail1, intSpinEmail2;
	int intEmail1, intEmail2, intEmail3, intEmail4, intEmail5;
	int intSpinIM1, intSpinIM2, intSpinIM3;
	int intIM1, intIM2, intIM3, intIM4, intIM5;
	int intSpinPostalAddr;
	int intStreet1, intStreet2, intStreet3;
	int intPOBox1, intPOBox2, intPOBox3;
	int intCity1, intCity2, intCity3;
	int intState1, intState2, intState3;
	int intZipCode1, intZipCode2, intZipCode3;
	int intCountry1, intCountry2, intCountry3;
	int intSpinSNS1, intSpinSNS2;
	int intSNS1, intSNS2, intSNS3, intSNS4, intSNS5;
	int intSpinOrg1_1, intSpinOrg1_2;
	int intOrg1_1, intOrg1_2, intOrg1_3;
	int intSpinOrg2_1, intSpinOrg2_2;
	int intOrg2_1, intOrg2_2, intOrg2_3;
	int intNotes1, intNotes2, intNotes3, intNotes4, intNotes5;
	int intTime1, intTime2, intTime3, intTime4;
	int PhotoSize;
	
	String StrVersion, StrTypes, StrOwner, StrGivenName, StrMiddleName, StrFamilyName, StrGender, StrSpinPhone,StrPhone,
		   StrSpinEmail, StrEmail, StrSpinIM, StrIM, StrSpinPostalAddr, StrStreet, StrPOBox, StrCity,
		   StrState, StrZipCode, StrCountry, StrSpinSNS, StrSNS, StrSpinOrg1, StrOrg1, StrSpinOrg2, StrOrg2, StrNotes, StrTime;
	
	int photo_length;
	byte[] photo_replace;
	
	public UpdatePacket(){}
	
	public UpdatePacket(byte[] data, int length){ 	
    	update_packet = new byte[length];
    	update_packet = data;
    } 

    public UpdatePacket(int length){
    	photo_length = length;
    } 
    
    String getVersion(){
      
    	intVersion = 0;

        for(int i = 0; i < 4; i++)
			intVersion += update_packet[i]<<(1919-i)*8; 
          
        StrVersion = convertHexToString(Integer.toHexString(intVersion)); 
        
    	return StrVersion;
    }
    
    String getTypes(){
    	
    	String Types1, Types2;
    	intTypes1 = 0;
    	intTypes2 = 0;

    	for(int i = 4; i < 8; i++)
    		intTypes1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 8; i < 12; i++)
			intTypes2 += update_packet[i]<<(1919-i)*8;
		
    	Types1 = convertHexToString(Integer.toHexString(intTypes1));
    	Types2 = convertHexToString(Integer.toHexString(intTypes2));
    	
    	StrTypes = Types1.concat(Types2);
    	
        return StrTypes;
    }
    
    
    String getGivenName(){ 
    	
    	String GivenName1, GivenName2, GivenName3;
    	
    	intGivenName1 = 0;
    	intGivenName2 = 0;
    	intGivenName3 = 0;

    	for(int i = 12; i < 16; i++)
    		intGivenName1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 16; i < 20; i++)
			intGivenName2 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 20; i < 24; i++)
			intGivenName3 += update_packet[i]<<(1919-i)*8;
		
    	GivenName1 = convertHexToString(Integer.toHexString(intGivenName1));
    	GivenName2 = convertHexToString(Integer.toHexString(intGivenName2));
    	GivenName3 = convertHexToString(Integer.toHexString(intGivenName3));
    	
    	StrGivenName = GivenName1.concat(GivenName2).concat(GivenName3); 
    	
    	return StrGivenName;
    }
    
	String getMiddleName(){ 
		
		String MiddleName1, MiddleName2;
    	
		intMiddleName1 = 0;
    	intMiddleName2 = 0;

    	for(int i = 24; i < 28; i++)
    		intMiddleName1 += update_packet[i]<<(1919-i)*8;
    	
    	for(int i = 28; i < 32; i++)
    		intMiddleName2 += update_packet[i]<<(1919-i)*8;
    	
		MiddleName1 = convertHexToString(Integer.toHexString(intMiddleName1));
    	MiddleName2 = convertHexToString(Integer.toHexString(intMiddleName2));
    	
    	StrMiddleName = MiddleName1.concat(MiddleName2);
    	
    	return StrMiddleName;
	}
	
	String getFamilyName(){
		
		String FamilyName1, FamilyName2, FamilyName3;
    	
    	intFamilyName1 = 0;
    	intFamilyName2 = 0;
    	intFamilyName3 = 0;

    	for(int i = 32; i < 36; i++)
    		intFamilyName1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 36; i < 40; i++)
			intFamilyName2 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 40; i < 44; i++)
			intFamilyName3 += update_packet[i]<<(1919-i)*8;
		
		FamilyName1 = convertHexToString(Integer.toHexString(intFamilyName1));
    	FamilyName2 = convertHexToString(Integer.toHexString(intFamilyName2));
    	FamilyName3 = convertHexToString(Integer.toHexString(intFamilyName3));
    	
    	StrFamilyName = FamilyName1.concat(FamilyName2).concat(FamilyName3); 
    	
        return StrFamilyName;
	}
	
	String getGender(){
		
		intGender = 0;

		for(int i = 44; i < 48; i++)
			intGender += update_packet[i]<<(1919-i)*8;
		
		StrGender = convertHexToString(Integer.toHexString(intGender)); 
        		
		return StrGender;
	}
	
	String getSpinPhone(){
		
		String SpinPhone1, SpinPhone2;
		intSpinPhone1 = 0;
		intSpinPhone2 = 0;

		for(int i = 48; i < 52; i++)
			intSpinPhone1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 52; i < 56; i++)
			intSpinPhone2 += update_packet[i]<<(1919-i)*8;
		
		SpinPhone1 = convertHexToString(Integer.toHexString(intSpinPhone1));
    	SpinPhone2 = convertHexToString(Integer.toHexString(intSpinPhone2));
    	
    	StrSpinPhone = SpinPhone1.concat(SpinPhone2);
    	
		return StrSpinPhone;
	}
	
	String getPhone(){ 
		
		String Phone1, Phone2, Phone3, Phone4;
		intPhone1 = 0;
		intPhone2 = 0;
		intPhone3 = 0;
		intPhone4 = 0;

		for(int i = 56; i < 60; i++)
			intPhone1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 60; i < 64; i++)
			intPhone2 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 64; i < 68; i++)
			intPhone3 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 68; i < 72; i++)
			intPhone4 += update_packet[i]<<(1919-i)*8;
		
		Phone1 = convertHexToString(Integer.toHexString(intPhone1));
		Phone2 = convertHexToString(Integer.toHexString(intPhone2));
		Phone3 = convertHexToString(Integer.toHexString(intPhone3));
		Phone4 = convertHexToString(Integer.toHexString(intPhone4));
		
    	StrPhone = Phone1.concat(Phone2).concat(Phone3).concat(Phone4); 

		return StrPhone;
	}
	
	String getSpinEmail(){ 
		
		String SpinEmail1, SpinEmail2;
		intSpinEmail1 = 0;
		intSpinEmail2 = 0;

		for(int i = 72; i < 76; i++)
			intSpinEmail1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 76; i < 80; i++)
			intSpinEmail2 += update_packet[i]<<(1919-i)*8;
		
		SpinEmail1 = convertHexToString(Integer.toHexString(intSpinPhone1));
    	SpinEmail2 = convertHexToString(Integer.toHexString(intSpinPhone2));
    	
    	StrSpinEmail = SpinEmail1.concat(SpinEmail2);
    	
		return StrSpinEmail;
	}
	
	String getEmail(){ 
		
		String Email1, Email2, Email3, Email4, Email5;
		
		intEmail1 = 0;
		intEmail2 = 0;
		intEmail3 = 0;
		intEmail4 = 0;
		intEmail5 = 0;

		for(int i = 80; i < 84; i++)
			intEmail1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 84; i < 88; i++)
			intEmail2 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 88; i < 92; i++)
			intEmail3 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 92; i < 96; i++)
			intEmail4 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 96; i < 100; i++)
			intEmail5 += update_packet[i]<<(1919-i)*8;
		
		Email1 = convertHexToString(Integer.toHexString(intEmail1));
		Email2 = convertHexToString(Integer.toHexString(intEmail2));
		Email3 = convertHexToString(Integer.toHexString(intEmail3));
		Email4 = convertHexToString(Integer.toHexString(intEmail4));
		Email5 = convertHexToString(Integer.toHexString(intEmail5));
		
    	StrEmail = Email1.concat(Email2).concat(Email3).concat(Email4).concat(Email5); 
    	
		return StrEmail;
	}

	String getSpinIM(){
		
		String SpinIM1, SpinIM2, SpinIM3;
		
		intSpinIM1 = 0;
		intSpinIM2 = 0;
		intSpinIM3 = 0;

		for(int i = 100; i < 104; i++)
			intSpinIM1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 104; i < 108; i++)
			intSpinIM2 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 108; i < 112; i++)
			intSpinIM3 += update_packet[i]<<(1919-i)*8;
		
		SpinIM1 = convertHexToString(Integer.toHexString(intSpinIM1));
		SpinIM2 = convertHexToString(Integer.toHexString(intSpinIM2));
		SpinIM3 = convertHexToString(Integer.toHexString(intSpinIM3));
    	
    	StrSpinIM = SpinIM1.concat(SpinIM2).concat(SpinIM3); 
    	
		return StrSpinIM;
	}
	
	String  getIM(){ 
		
		String IM1, IM2, IM3, IM4, IM5;
		intIM1 = 0;
		intIM2 = 0;
		intIM3 = 0;
		intIM4 = 0;
		intIM5 = 0;
		
		for(int i = 112; i < 116; i++)
			intIM1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 116; i < 120; i++)
			intIM2 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 120; i < 124; i++)
			intIM3 += update_packet[i]<<(1919-i)*8;
			
		for(int i = 124; i < 128; i++)
			intIM4 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 128; i < 132; i++)
			intIM5 += update_packet[i]<<(1919-i)*8;
				
		IM1 = convertHexToString(Integer.toHexString(intIM1));
		IM2 = convertHexToString(Integer.toHexString(intIM2));
		IM3 = convertHexToString(Integer.toHexString(intIM3));
		IM4 = convertHexToString(Integer.toHexString(intIM4));
		IM5 = convertHexToString(Integer.toHexString(intIM5));
		
    	StrIM = IM1.concat(IM2).concat(IM3).concat(IM4).concat(IM5); 
    	
    	return StrIM;
	}
	
	String getSpinPostalAddr(){
			
		intSpinPostalAddr = 0;

		for(int i = 132; i < 136; i++)
			intSpinPostalAddr += update_packet[i]<<(1919-i)*8;
		
		StrSpinPostalAddr = convertHexToString(Integer.toHexString(intSpinPostalAddr)); 
		
		return StrSpinPostalAddr;
	}
	
	String getStreet(){ 
		
		String Street1, Street2, Street3;
		intStreet1 = 0;
		intStreet2 = 0;
		intStreet3 = 0;

		for(int i = 136; i < 140; i++)
			intStreet1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 140; i < 144; i++)
			intStreet2 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 144; i < 148; i++)
			intStreet3 += update_packet[i]<<(1919-i)*8;
		
		Street1 = convertHexToString(Integer.toHexString(intStreet1));
		Street2 = convertHexToString(Integer.toHexString(intStreet2));
		Street3 = convertHexToString(Integer.toHexString(intStreet3));
    	
    	StrStreet = Street1.concat(Street2).concat(Street3); 
    	
		return StrStreet;
	}
	
	String getPOBox(){ 
			
		String POBox1, POBox2, POBox3;
		intPOBox1 = 0;
		intPOBox2 = 0;
		intPOBox3 = 0;

		for(int i = 148; i < 152; i++)
			intPOBox1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 152; i < 156; i++)
			intPOBox2 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 156; i < 160; i++)
			intPOBox3 += update_packet[i]<<(1919-i)*8;
		
		POBox1 = convertHexToString(Integer.toHexString(intPOBox1));
		POBox2 = convertHexToString(Integer.toHexString(intPOBox2));
		POBox3 = convertHexToString(Integer.toHexString(intPOBox3));
    	
    	StrPOBox = POBox1.concat(POBox2).concat(POBox3);
    	
		return StrPOBox;
	}
	
	String getCity(){ 
		
		String City1, City2, City3;
		intCity1 = 0;
		intCity2 = 0;
		intCity3 = 0;

		for(int i = 160; i < 164; i++)
			intCity1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 164; i < 168; i++)
			intCity2 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 168; i < 172; i++)
			intCity3 += update_packet[i]<<(1919-i)*8;
		
		City1 = convertHexToString(Integer.toHexString(intCity1));
		City2 = convertHexToString(Integer.toHexString(intCity2));
		City3 = convertHexToString(Integer.toHexString(intCity3));
    	
    	StrCity = City1.concat(City2).concat(City3);
    	
		return StrCity;
	}
	
	String getState(){
			
		String State1, State2, State3;
		intState1 = 0;
		intState2 = 0;
		intState3 = 0;
    
		for(int i = 172; i < 176; i++)
			intState1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 176; i < 180; i++)
			intState2 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 180; i < 184; i++)
			intState3 += update_packet[i]<<(1919-i)*8;
		
		State1 = convertHexToString(Integer.toHexString(intState1));
		State2 = convertHexToString(Integer.toHexString(intState2));
		State3 = convertHexToString(Integer.toHexString(intState3));
    	
    	StrState = State1.concat(State2).concat(State3);
    	
		return StrState;
	}
	
	String getZipCode(){
		
		String ZipCode1, ZipCode2, ZipCode3;
		intZipCode1 = 0;
		intZipCode2 = 0;
		intZipCode3 = 0;
		   
		for(int i = 184; i < 188; i++)
			intZipCode1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 188; i < 192; i++)
			intZipCode2 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 192; i < 196; i++)
			intZipCode3 += update_packet[i]<<(1919-i)*8;
		
		ZipCode1 = convertHexToString(Integer.toHexString(intZipCode1));
		ZipCode2 = convertHexToString(Integer.toHexString(intZipCode2));
		ZipCode3 = convertHexToString(Integer.toHexString(intZipCode3));
    	
    	StrZipCode = ZipCode1.concat(ZipCode2).concat(ZipCode3);
		
    	return StrZipCode;
	}
	
	String getCountry(){ 
		
		String Country1, Country2, Country3;
		intCountry1 = 0;
		intCountry2 = 0;
		intCountry3 = 0;
		
		for(int i = 196; i < 200; i++)
			intCountry1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 200; i < 204; i++)
			intCountry2 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 204; i < 208; i++)
			intCountry3 += update_packet[i]<<(1919-i)*8;
		
		Country1 = convertHexToString(Integer.toHexString(intCountry1));
		Country2 = convertHexToString(Integer.toHexString(intCountry2));
		Country3 = convertHexToString(Integer.toHexString(intCountry3));
    	
    	StrCountry = Country1.concat(Country2).concat(Country3);
    	
		return StrCountry;
	}
	
	String getSpinSNS(){
		
		String SpinSNS1, SpinSNS2;
		intSpinSNS1 = 0;
		intSpinSNS2 = 0;

		for(int i = 208; i < 212; i++)
			intSpinSNS1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 212; i < 216; i++)
			intSpinSNS2 += update_packet[i]<<(1919-i)*8;
		
		SpinSNS1 = convertHexToString(Integer.toHexString(intSpinSNS1));
    	SpinSNS2 = convertHexToString(Integer.toHexString(intSpinSNS2));
    	
    	StrSpinSNS = SpinSNS1.concat(SpinSNS2);
		
		return StrSpinSNS;
	}
	
	String getSNS(){ 
		
		String SNS1, SNS2, SNS3, SNS4, SNS5;
		intSNS1 = 0;
		intSNS2 = 0;
		intSNS3 = 0;
		intSNS4 = 0;
		intSNS5 = 0;

		for(int i = 216; i < 220; i++)
			intSNS1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 220; i < 224; i++)
			intSNS2 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 224; i < 228; i++)
			intSNS3 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 228; i < 232; i++)
			intSNS4 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 232; i < 236; i++)
			intSNS5 += update_packet[i]<<(1919-i)*8;
		
		SNS1 = convertHexToString(Integer.toHexString(intSNS1));
		SNS2 = convertHexToString(Integer.toHexString(intSNS2));
		SNS3 = convertHexToString(Integer.toHexString(intSNS3));
		SNS4 = convertHexToString(Integer.toHexString(intSNS4));
		SNS5 = convertHexToString(Integer.toHexString(intSNS5));
		
    	StrSNS = SNS1.concat(SNS2).concat(SNS3).concat(SNS4).concat(SNS5); 
		
		return StrSNS;
	}
	
	String getSpinOrg1(){ 
		
		String SpinOrg1_1, SpinOrg1_2;
		intSpinOrg1_1 = 0;
		intSpinOrg1_2 = 0;

		for(int i = 236; i < 240; i++)
			intSpinOrg1_1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 240; i < 244; i++)
			intSpinOrg1_2 += update_packet[i]<<(1919-i)*8;
				
		SpinOrg1_1 = convertHexToString(Integer.toHexString(intSpinOrg1_1));
    	SpinOrg1_2 = convertHexToString(Integer.toHexString(intSpinOrg1_2));
    	
    	StrSpinOrg1 = SpinOrg1_1.concat(SpinOrg1_2);
    	
		return StrSpinOrg1;
	}
	
	String getOrg1(){ 
		
		String Org1_1, Org1_2, Org1_3;
		intOrg1_1 = 0;
		intOrg1_2 = 0;
		intOrg1_3 = 0;

		for(int i = 244; i < 248; i++)
			intOrg1_1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 248; i < 252; i++)
			intOrg1_2 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 252; i < 256; i++)
			intOrg1_3 += update_packet[i]<<(1919-i)*8;
		
		
		Org1_1 = convertHexToString(Integer.toHexString(intOrg1_1));
		Org1_2 = convertHexToString(Integer.toHexString(intOrg1_2));
		Org1_3 = convertHexToString(Integer.toHexString(intOrg1_3));
    	
		StrOrg1 = Org1_1.concat(Org1_2).concat(Org1_3);
		
		return StrOrg1;
	}
	
	String getSpinOrg2(){ 
		
		String SpinOrg2_1, SpinOrg2_2;
		intSpinOrg2_1 = 0;
		intSpinOrg2_2 = 0;

		for(int i = 256; i < 260; i++)
			intSpinOrg2_1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 260; i < 264; i++)
			intSpinOrg2_2 += update_packet[i]<<(1919-i)*8;
		
		
		SpinOrg2_1 = convertHexToString(Integer.toHexString(intSpinOrg2_1));
    	SpinOrg2_2 = convertHexToString(Integer.toHexString(intSpinOrg2_2));
    	
    	StrSpinOrg2 = SpinOrg2_1.concat(SpinOrg2_2);
    	
		return StrSpinOrg2;
	}
	
	String getOrg2(){ 
	
		String Org2_1, Org2_2, Org2_3;
		intOrg2_1 = 0;
		intOrg2_2 = 0;
		intOrg2_3 = 0;

		for(int i = 264; i < 268; i++)
			intOrg2_1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 268; i < 272; i++)
			intOrg2_2 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 272; i < 276; i++)
			intOrg2_3 += update_packet[i]<<(1919-i)*8;
		
		Org2_1 = convertHexToString(Integer.toHexString(intOrg2_1));
		Org2_2 = convertHexToString(Integer.toHexString(intOrg2_2));
		Org2_3 = convertHexToString(Integer.toHexString(intOrg2_3));
    	
		StrOrg2 = Org2_1.concat(Org2_2).concat(Org2_3);
		
		return StrOrg2;
	}
	
	String getNotes(){
		
		String Notes1, Notes2, Notes3, Notes4, Notes5;
		intNotes1 = 0;
		intNotes2 = 0;
		intNotes3 = 0;
		intNotes4 = 0;
		intNotes5 = 0;

		for(int i = 276; i < 280; i++)
			intNotes1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 280; i < 284; i++)
			intNotes2 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 284; i < 288; i++)
			intNotes3 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 288; i < 292; i++)
			intNotes4 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 292; i < 296; i++)
			intNotes5 += update_packet[i]<<(1919-i)*8;
				
        Notes1 = convertHexToString(Integer.toHexString(intNotes1));
		Notes2 = convertHexToString(Integer.toHexString(intNotes2));
		Notes3 = convertHexToString(Integer.toHexString(intNotes3));
		Notes4 = convertHexToString(Integer.toHexString(intNotes4));
		Notes5 = convertHexToString(Integer.toHexString(intNotes5));
		
    	StrNotes = Notes1.concat(Notes2).concat(Notes3).concat(Notes4).concat(Notes5); 
    	
		return StrNotes;
	}
	
	String getTime(){ 
		
		String Time1, Time2, Time3, Time4;
		intTime1 = 0;
		intTime2 = 0;
		intTime3 = 0;
		intTime4 = 0;
		
		for(int i = 296; i < 300; i++)
			intTime1 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 300; i < 304; i++)
			intTime2 += update_packet[i]<<(1919-i)*8;
		
		for(int i = 304; i < 308; i++)
			intTime3 += update_packet[i]<<(1919-i)*8;
		
		intTime4 += update_packet[308]<<24; 
		intTime4 += update_packet[309]<<16; 
		intTime4 += update_packet[310]<<8; 
		intTime4 += (0XFF)&update_packet[311];	//16 
		
        Time1 = convertHexToString(Integer.toHexString(intTime1));
		Time2 = convertHexToString(Integer.toHexString(intTime2));
		Time3 = convertHexToString(Integer.toHexString(intTime3));
		Time4 = convertHexToString(Integer.toHexString(intTime4));
		
    	StrTime = Time1.concat(Time2).concat(Time3).concat(Time4); 
        
		return StrTime;
	}
	

	String getPhotosize(){
	
		String strPhotoSize;
	
		PhotoSize = 0;
	
		for(int i = 312; i < 316; i++)
			PhotoSize += update_packet[i]<<(1919-i)*8;
	
		strPhotoSize = convertHexToString(Integer.toHexString(PhotoSize));
	
		return strPhotoSize;
	}
	
	String getOwner(){
	      
    	intOwner = 0;

        for(int i = 316; i < 320; i++)
			intOwner += update_packet[i]<<(1919-i)*8; 
          
        StrOwner = convertHexToString(Integer.toHexString(intOwner)); 
        
    	return StrOwner;
    }

	 byte[] getPhoto(int length){
		 
		 byte[] bytePhoto = new byte[length];

		    for(int i = 320; i < length + 320; i++)
		    		bytePhoto[i-320] = update_packet[i];
		    	      
		    String aString = Integer.toString(bytePhoto.length);        
		    	
		    return bytePhoto; 
 				 	    		   
	 }
	
	 void setVersion(String version){
		
		int intVersion = Integer.parseInt(convertStringToHex(version), 16);	

		for(int i = 0; i < 4; i++)
			update_packet[i] = (byte)(0XFF&(intVersion>>(1919-i)*8)); 
		      
	}
	
    void setTypes(String types){
    	    	
    	String strTypes1 = " ";
		String strTypes2 = " ";		
    	
		if(types.length() <= 4){
			strTypes1 = types.substring(0, types.length());
			strTypes2 = " ";
		} else if(types.length() > 4){
			strTypes1 = types.substring(0, 4);
			strTypes2 = types.substring(4, types.length());
		}
		
		int intTypes1 = Integer.parseInt(convertStringToHex(strTypes1), 16);  
		int intTypes2 = Integer.parseInt(convertStringToHex(strTypes2), 16); 

		for(int i = 4; i < 8; i++)
			update_packet[i] = (byte)(0XFF&(intTypes1>>(1919-i)*8));
		
		for(int i = 8; i < 12; i++)
			update_packet[i] = (byte)(0XFF&(intTypes2>>(1919-i)*8));
	
    }
    
    void setGivenName(String givenname){
    	
    	String strGivenName1 = " ";
    	String strGivenName2 = " "; 
    	String strGivenName3 = " ";
    	
    	if(givenname.length() <= 4){
			strGivenName1 = givenname.substring(0, givenname.length());
			strGivenName2 = " ";
			strGivenName3 = " ";
		} else if( (givenname.length()<=8) && (givenname.length()> 4) ){
			strGivenName1 = givenname.substring(0, 4);
			strGivenName2 = givenname.substring(4, givenname.length());
			strGivenName3 = " ";
		} else if (givenname.length() > 8){
			strGivenName1 = givenname.substring(0, 4);
			strGivenName2 = givenname.substring(4, 8);
			strGivenName3 = givenname.substring(8, 10);
		}
    		
    	int intGivenName1 = Integer.parseInt(convertStringToHex(strGivenName1), 16);  
		int intGivenName2 = Integer.parseInt(convertStringToHex(strGivenName2), 16); 
		int intGivenName3 = Integer.parseInt(convertStringToHex(strGivenName3), 16); 
    	    	
    	
    	for(int i = 12; i < 16; i++)
			update_packet[i] = (byte)(0XFF&(intGivenName1>>(1919-i)*8));
		
		for(int i = 16; i < 20; i++)
			update_packet[i] = (byte)(0XFF&(intGivenName2>>(1919-i)*8));
		
		for(int i = 20; i < 24; i++)
			update_packet[i] = (byte)(0XFF&(intGivenName3>>(1919-i)*8));
		 
    }
    
    void setMiddleName(String middlename){
    	
    	String strMiddleName1 = " ";
    	String strMiddleName2 = " ";
    	    	
		if(middlename.length() <= 4){
			strMiddleName1 = middlename.substring(0, middlename.length());
			strMiddleName2 = " ";
		} else if(middlename.length() > 4){
			strMiddleName1 = middlename.substring(0, 4);
			strMiddleName2 = middlename.substring(4, middlename.length());
		}
		    	
		int intMiddleName1 = Integer.parseInt(convertStringToHex(strMiddleName1), 16); 
		int intMiddleName2 = Integer.parseInt(convertStringToHex(strMiddleName2), 16); 
		
    	for(int i = 24; i < 28; i++)
			update_packet[i] = (byte)(0XFF&(intMiddleName1>>(1919-i)*8));
    	
    	for(int i = 28; i < 32; i++)
			update_packet[i] = (byte)(0XFF&(intMiddleName2>>(1919-i)*8));
    	
    }

    void setFamilyName(String familyname){
    	
    	String strFamilyName1 = " ";
    	String strFamilyName2 = " ";
    	String strFamilyName3 = " ";
		
		if(familyname.length() <= 4){
			strFamilyName1 = familyname.substring(0, familyname.length());
			strFamilyName2 = "    ";
			strFamilyName3 = "  ";
		} else if( (familyname.length()<=8) && (familyname.length()> 4) ){
			strFamilyName1 = familyname.substring(0, 4);
			strFamilyName2 = familyname.substring(4, familyname.length());
			strFamilyName3 = "  ";
		} else if (familyname.length() > 8){
			strFamilyName1 = familyname.substring(0, 4);
			strFamilyName2 = familyname.substring(4, 8);
			strFamilyName3 = familyname.substring(8, 10);
		}

		int intFamilyName1 = Integer.parseInt(convertStringToHex(strFamilyName1), 16); 
		int intFamilyName2 = Integer.parseInt(convertStringToHex(strFamilyName2), 16); 
		int intFamilyName3 = Integer.parseInt(convertStringToHex(strFamilyName3), 16); 
   
		for(int i = 32; i < 36; i++)
			update_packet[i] = (byte)(0XFF&(intFamilyName1>>(1919-i)*8));
		
		for(int i = 36; i < 40; i++)
			update_packet[i] = (byte)(0XFF&(intFamilyName2>>(1919-i)*8));
		
		for(int i = 40; i < 44; i++)
			update_packet[i] = (byte)(0XFF&(intFamilyName3>>(1919-i)*8));
					
    }
    
    void setGender(String gender){    	
    			
		int intGender = Integer.parseInt(convertStringToHex(gender), 16); 
    	
		for(int i = 44; i < 48; i++)
			update_packet[i] = (byte)(0XFF&(intGender>>(1919-i)*8));
		  	
    }

    void setSpinPhone(String spinphone){ 	
    	
		String strSpinPhone1 = " ";
		String strSpinPhone2 = " ";
    	
		if(spinphone.length() <= 4){
			strSpinPhone1 = spinphone.substring(0, spinphone.length());
			strSpinPhone2 = " ";
		} else if(spinphone.length() > 4){
			strSpinPhone1 = spinphone.substring(0, 4);
			strSpinPhone2 = spinphone.substring(4, 8);
		}
		
		int intSpinPhone1 = Integer.parseInt(convertStringToHex(strSpinPhone1), 16);  
		int intSpinPhone2 = Integer.parseInt(convertStringToHex(strSpinPhone2), 16); 
		
		for(int i = 48; i < 52; i++)
			update_packet[i] = (byte)(0XFF&(intSpinPhone1>>(1919-i)*8));
		
		for(int i = 52; i < 56; i++)
			update_packet[i] = (byte)(0XFF&(intSpinPhone2>>(1919-i)*8));
    	
    }

    void setPhone(String phone){ 	
    
    	String strPhone1 = " ";
    	String strPhone2 = " ";
    	String strPhone3 = " ";
    	String strPhone4 = " ";
    	
		if(phone.length() <= 4){
			strPhone1 = phone.substring(0, phone.length());
			strPhone2 = " ";
			strPhone3 = " ";
			strPhone4 = " ";
		} else if( (phone.length()<=8) && (phone.length()> 4) ){
			strPhone1 = phone.substring(0, 4);
			strPhone2 = phone.substring(4, phone.length());
			strPhone3 = " ";
			strPhone4 = " ";
		} else if ((phone.length()<=12) && (phone.length() > 8)){
			strPhone1 = phone.substring(0, 4);
			strPhone2 = phone.substring(4, 8);
			strPhone3 = phone.substring(8, phone.length());
			strPhone4 = " ";
		} else if ((phone.length()<=16) && (phone.length() > 12)){
			strPhone1 = phone.substring(0, 4);
			strPhone2 = phone.substring(4, 8);
			strPhone3 = phone.substring(8, 12);
			strPhone4 = phone.substring(12, phone.length());	
		}
								
		int intPhone1 = Integer.parseInt(convertStringToHex(strPhone1), 16);  
		int intPhone2 = Integer.parseInt(convertStringToHex(strPhone2), 16);  
		int intPhone3 = Integer.parseInt(convertStringToHex(strPhone3), 16);  
		int intPhone4 = Integer.parseInt(convertStringToHex(strPhone4), 16);  	
		
		for(int i = 56; i < 60; i++)
			update_packet[i] = (byte)(0XFF&(intPhone1>>(1919-i)*8));
		
		for(int i = 60; i < 64; i++)
			update_packet[i] = (byte)(0XFF&(intPhone2>>(1919-i)*8));
		
		for(int i = 64; i < 68; i++)
			update_packet[i] = (byte)(0XFF&(intPhone3>>(1919-i)*8));
		
		for(int i = 68; i < 72; i++)
			update_packet[i] = (byte)(0XFF&(intPhone4>>(1919-i)*8));
		
    }

    void setSpinEmail(String spinemail){
    	
    	String strSpinEmail1 = " ";
    	String strSpinEmail2 = " ";
    	
    	if(spinemail.length() <= 4){
			strSpinEmail1 = spinemail.substring(0, spinemail.length());
			strSpinEmail2 = " ";
		} else if(spinemail.length() > 4){
			strSpinEmail1 = spinemail.substring(0, 4);
			strSpinEmail2 = spinemail.substring(4, spinemail.length());
		}
    		
    	int intSpinEmail1 = Integer.parseInt(convertStringToHex(strSpinEmail1), 16); 
		int intSpinEmail2 = Integer.parseInt(convertStringToHex(strSpinEmail2), 16);			
    	
		for(int i = 72; i < 76; i++)
			update_packet[i] = (byte)(0XFF&(intSpinEmail1>>(1919-i)*8));
		
		for(int i = 76; i < 80; i++)
			update_packet[i] = (byte)(0XFF&(intSpinEmail2>>(1919-i)*8));
		
    }

    void setEmail(String email){

		String strEmail1 = " ";
		String strEmail2 = " ";
		String strEmail3 = " ";
		String strEmail4 = " ";
		String strEmail5 = " ";
		
		if(email.length() <= 4){
			strEmail1 = email.substring(0, email.length());
			strEmail2 = " ";
			strEmail3 = " ";
			strEmail4 = " ";
			strEmail5 = " ";
		} else if( (email.length()<=8) && (email.length()> 4) ){
			strEmail1 = email.substring(0, 4);
			strEmail2 = email.substring(4, email.length());
			strEmail3 = " ";
			strEmail4 = " ";
			strEmail5 = " ";
		} else if ((email.length()<=12) && (email.length() > 8)){
			strEmail1 = email.substring(0, 4);
			strEmail2 = email.substring(4, 8);
			strEmail3 = email.substring(8, email.length());
			strEmail4 = " ";
			strEmail5 = " ";
		} else if ((email.length()<=16) && (email.length() > 12)){
			strEmail1 = email.substring(0, 4);
			strEmail2 = email.substring(4, 8);
			strEmail3 = email.substring(8, 12);
			strEmail4 = email.substring(12, email.length());
			strEmail5 = " ";
		} else if ((email.length()<=20) && (email.length() > 16)){
			strEmail1 = email.substring(0, 4);
			strEmail2 = email.substring(4, 8);
			strEmail3 = email.substring(8, 12);
			strEmail4 = email.substring(12, 16);	
			strEmail5 = email.substring(16, email.length());
		}
				
		int intEmail1 = Integer.parseInt(convertStringToHex(strEmail1), 16);  
		int intEmail2 = Integer.parseInt(convertStringToHex(strEmail2), 16); 
		int intEmail3 = Integer.parseInt(convertStringToHex(strEmail3), 16); 
		int intEmail4 = Integer.parseInt(convertStringToHex(strEmail4), 16); 
		int intEmail5 = Integer.parseInt(convertStringToHex(strEmail5), 16); 
		
		for(int i = 80; i < 84; i++)
			update_packet[i] = (byte)(0XFF&(intEmail1>>(1919-i)*8));
		
		for(int i = 84; i < 88; i++)
			update_packet[i] = (byte)(0XFF&(intEmail2>>(1919-i)*8));
		
		for(int i = 88; i < 92; i++)
			update_packet[i] = (byte)(0XFF&(intEmail3>>(1919-i)*8));
		
		for(int i = 92; i < 96; i++)
			update_packet[i] = (byte)(0XFF&(intEmail4>>(1919-i)*8));
		
		for(int i = 96; i < 100; i++)
			update_packet[i] = (byte)(0XFF&(intEmail5>>(1919-i)*8));
		
    }

    void setSpinIM(String spinim){
    	
    	String strSpinIM1 = " ";
    	String strSpinIM2 = " ";
    	String strSpinIM3 = " ";
    	
    	if(spinim.length() <= 4){
			strSpinIM1 = spinim.substring(0, spinim.length());
			strSpinIM2 = " ";
			strSpinIM3 = " ";
		} else if( (spinim.length()<=8) && (spinim.length()> 4) ){
			strSpinIM1 = spinim.substring(0, 4);
			strSpinIM2 = spinim.substring(4, spinim.length());
			strSpinIM3 = " ";
		} else if (spinim.length() > 8){
			strSpinIM1 = spinim.substring(0, 4);
			strSpinIM2 = spinim.substring(4, 8);
			strSpinIM3 = spinim.substring(8, spinim.length());
		}
		
    	int intSpinIM1 = Integer.parseInt(convertStringToHex(strSpinIM1), 16); 
		int intSpinIM2 = Integer.parseInt(convertStringToHex(strSpinIM2), 16); 
		int intSpinIM3 = Integer.parseInt(convertStringToHex(strSpinIM3), 16);
    		
		for(int i = 100; i < 104; i++)
			update_packet[i] = (byte)(0XFF&(intSpinIM1>>(1919-i)*8));
		
		for(int i = 104; i < 108; i++)
			update_packet[i] = (byte)(0XFF&(intSpinIM2>>(1919-i)*8));
		
		for(int i = 108; i < 112; i++)
			update_packet[i] = (byte)(0XFF&(intSpinIM3>>(1919-i)*8));
		
    }

    void setIM(String im){ 
    	
    	String strIM1 = " ";
    	String strIM2 = " ";
    	String strIM3 = " ";
    	String strIM4 = " ";
    	String strIM5 = " ";
    	
		if(im.length() <= 4){
			strIM1 = im.substring(0, im.length());
			strIM2 = " ";
			strIM3 = " ";
			strIM4 = " ";
			strIM5 = " ";
		} else if( (im.length()<=8) && (im.length()> 4) ){
			strIM1 = im.substring(0, 4);
			strIM2 = im.substring(4, im.length());
			strIM3 = " ";
			strIM4 = " ";
			strIM5 = " ";
		} else if ((im.length()<=12) && (im.length() > 8)){
			strIM1 = im.substring(0, 4);
			strIM2 = im.substring(4, 8);
			strIM3 = im.substring(8, im.length());
			strIM4 = " ";
			strIM5 = " ";
		} else if ((im.length()<=16) && (im.length() > 12)){
			strIM1 = im.substring(0, 4);
			strIM2 = im.substring(4, 8);
			strIM3 = im.substring(8, 12);
			strIM4 = im.substring(12, im.length());
			strIM5 = " ";
		} else if ((im.length()<=20) && (im.length() > 16)){
			strIM1 = im.substring(0, 4);
			strIM2 = im.substring(4, 8);
			strIM3 = im.substring(8, 12);
			strIM4 = im.substring(12, 16);	
			strIM5 = im.substring(16, im.length());
		}
		
		int intIM1 = Integer.parseInt(convertStringToHex(strIM1), 16);  
		int intIM2 = Integer.parseInt(convertStringToHex(strIM2), 16);  
		int intIM3 = Integer.parseInt(convertStringToHex(strIM3), 16);  
		int intIM4 = Integer.parseInt(convertStringToHex(strIM4), 16);  
		int intIM5 = Integer.parseInt(convertStringToHex(strIM5), 16);  	
    	
		for(int i = 112; i < 116; i++)
			update_packet[i] = (byte)(0XFF&(intIM1>>(1919-i)*8));
		
		for(int i = 116; i < 120; i++)
			update_packet[i] = (byte)(0XFF&(intIM2>>(1919-i)*8));
		
		for(int i = 120; i < 124; i++)
			update_packet[i] = (byte)(0XFF&(intIM3>>(1919-i)*8));
			
		for(int i = 124; i < 128; i++)
			update_packet[i] = (byte)(0XFF&(intIM4>>(1919-i)*8));
		
		for(int i = 128; i < 132; i++)
			update_packet[i] = (byte)(0XFF&(intIM5>>(1919-i)*8));

    }
    	
    void setSpinPostalAddr(String spinpostaladdr){ 	
		
		int intSpinPostalAddr = Integer.parseInt(convertStringToHex(spinpostaladdr), 16);  
    	
		for(int i = 132; i < 136; i++)
			update_packet[i] = (byte)(0XFF&(intSpinPostalAddr>>(1919-i)*8));
		
    }

    void setStreet(String street){ 	
    
    	String strStreet1 = " ";
    	String strStreet2 = " ";
    	String strStreet3 = " ";
		
		if(street.length() <= 4){
			strStreet1 = street.substring(0, street.length());
			strStreet2 = " ";
			strStreet3 = " ";
		} else if( (street.length()<=8) && (street.length()> 4) ){
			strStreet1 = street.substring(0, 4);
			strStreet2 = street.substring(4, street.length());
			strStreet3 = " ";
		} else if (street.length() > 8){
			strStreet1 = street.substring(0, 4);
			strStreet2 = street.substring(4, 8);
			strStreet3 = street.substring(8, street.length());
		}

		int intStreet1 = Integer.parseInt(convertStringToHex(strStreet1), 16);  
		int intStreet2 = Integer.parseInt(convertStringToHex(strStreet2), 16); 
		int intStreet3 = Integer.parseInt(convertStringToHex(strStreet3), 16); 
		
		for(int i = 136; i < 140; i++)
			update_packet[i] = (byte)(0XFF&(intStreet1>>(1919-i)*8));
		
		for(int i = 140; i < 144; i++)
			update_packet[i] = (byte)(0XFF&(intStreet2>>(1919-i)*8));
		
		for(int i = 144; i < 148; i++)
			update_packet[i] = (byte)(0XFF&(intStreet3>>(1919-i)*8));

    }

    void setPOBox(String pobox){
 	    
    	String strPOBox1 = " ";
    	String strPOBox2 = " ";
    	String strPOBox3 = " ";
    	
    	if(pobox.length() <= 4){
			strPOBox1 = pobox.substring(0, pobox.length());
			strPOBox2 = " ";
			strPOBox3 = " ";
		} else if( (pobox.length()<=8) && (pobox.length()> 4) ){
			strPOBox1 = pobox.substring(0, 4);
			strPOBox2 = pobox.substring(4, pobox.length());
			strPOBox3 = " ";
		} else if (pobox.length() > 8){
			strPOBox1 = pobox.substring(0, 4);
			strPOBox2 = pobox.substring(4, 8);
			strPOBox3 = pobox.substring(8, pobox.length());
		}
    			
		int intPOBox1 = Integer.parseInt(convertStringToHex(strPOBox1), 16);  
		int intPOBox2 = Integer.parseInt(convertStringToHex(strPOBox2), 16); 
		int intPOBox3 = Integer.parseInt(convertStringToHex(strPOBox3), 16); 
        
		for(int i = 148; i < 152; i++)
			update_packet[i] = (byte)(0XFF&(intPOBox1>>(1919-i)*8));
		
		for(int i = 152; i < 156; i++)
			update_packet[i] = (byte)(0XFF&(intPOBox2>>(1919-i)*8));
		
		for(int i = 156; i < 160; i++)
			update_packet[i] = (byte)(0XFF&(intPOBox3>>(1919-i)*8));
		  
    }

    void setCity(String city){    	
    	
		String strCity1 = " ";
		String strCity2 = " ";
		String strCity3 = " ";
		
    	if(city.length() <= 4){
			strCity1 = city.substring(0, city.length());
			strCity2 = " ";
			strCity3 = " ";
		} else if( (city.length()<=8) && (city.length()> 4) ){
			strCity1 = city.substring(0, 4);
			strCity2 = city.substring(4, city.length());
			strCity3 = " ";
		} else if (city.length() > 8){
			strCity1 = city.substring(0, 4);
			strCity2 = city.substring(4, 8);
			strCity3 = city.substring(8, city.length());
		}
    	
		int intCity1 = Integer.parseInt(convertStringToHex(strCity1), 16);  
		int intCity2 = Integer.parseInt(convertStringToHex(strCity2), 16);
		int intCity3 = Integer.parseInt(convertStringToHex(strCity3), 16);
    	
		for(int i = 160; i < 164; i++)
			update_packet[i] = (byte)(0XFF&(intCity1>>(1919-i)*8));
		
		for(int i = 164; i < 168; i++)
			update_packet[i] = (byte)(0XFF&(intCity2>>(1919-i)*8));
		
		for(int i = 168; i < 172; i++)
			update_packet[i] = (byte)(0XFF&(intCity3>>(1919-i)*8));
		
    }

    void setState(String state){
    	
    	String strState1 = " ";
    	String strState2 = " ";
    	String strState3 = " ";
    	
		if(state.length() <= 4){
			strState1 = state.substring(0, state.length());
			strState2 = " ";
			strState3 = " ";
		} else if( (state.length()<=8) && (state.length()> 4) ){
			strState1 = state.substring(0, 4);
			strState2 = state.substring(4, state.length());
			strState3 = " ";
		} else if (state.length() > 8){
			strState1 = state.substring(0, 4);
			strState2 = state.substring(4, 8);
			strState3 = state.substring(8, state.length());
		}

		int intState1 = Integer.parseInt(convertStringToHex(strState1), 16); 
		int intState2 = Integer.parseInt(convertStringToHex(strState2), 16); 
		int intState3 = Integer.parseInt(convertStringToHex(strState3), 16); 
		
		for(int i = 172; i < 176; i++)
			update_packet[i] = (byte)(0XFF&(intState1>>(1919-i)*8));
		
		for(int i = 176; i < 180; i++)
			update_packet[i] = (byte)(0XFF&(intState2>>(1919-i)*8));
		
		for(int i = 180; i < 184; i++)
			update_packet[i] = (byte)(0XFF&(intState3>>(1919-i)*8));
		     	
    }

    void setZipCode(String zipcode){
    	
    	String strZipCode1 = " ";
    	String strZipCode2 = " ";
    	String strZipCode3 = " ";
    	
		if(zipcode.length() <= 4){
			strZipCode1 = zipcode.substring(0, zipcode.length());
			strZipCode2 = " ";
			strZipCode3 = " ";
		} else if( (zipcode.length()<=8) && (zipcode.length()> 4) ){
			strZipCode1 = zipcode.substring(0, 4);
			strZipCode2 = zipcode.substring(4, zipcode.length());
			strZipCode3 = " ";
		} else if (zipcode.length() > 8){
			strZipCode1 = zipcode.substring(0, 4);
			strZipCode2 = zipcode.substring(4, 8);
			strZipCode3 = zipcode.substring(8, zipcode.length());
		}
		
		int intZipCode1 = Integer.parseInt(convertStringToHex(strZipCode1), 16);
		int intZipCode2 = Integer.parseInt(convertStringToHex(strZipCode2), 16);
		int intZipCode3 = Integer.parseInt(convertStringToHex(strZipCode3), 16);
		
		for(int i = 184; i < 188; i++)
			update_packet[i] = (byte)(0XFF&(intZipCode1>>(1919-i)*8));
		
		for(int i = 188; i < 192; i++)
			update_packet[i] = (byte)(0XFF&(intZipCode2>>(1919-i)*8));
		
		for(int i = 192; i < 196; i++)
			update_packet[i] = (byte)(0XFF&(intZipCode3>>(1919-i)*8));
          
    }

    void setCountry(String country){
    	
    	String strCountry1 = " ";
    	String strCountry2 = " ";
    	String strCountry3 = " ";
    	
		if(country.length() <= 4){
			strCountry1 = country.substring(0, country.length());
			strCountry2 = " ";
			strCountry3 = " ";
		} else if( (country.length()<=8) && (country.length()> 4) ){
			strCountry1 = country.substring(0, 4);
			strCountry2 = country.substring(4, country.length());
			strCountry3 = " ";
		} else if (country.length() > 8){
			strCountry1 = country.substring(0, 4);
			strCountry2 = country.substring(4, 8);
			strCountry3 = country.substring(8, country.length());
		}
    	
		int intCountry1 = Integer.parseInt(convertStringToHex(strCountry1), 16);  
		int intCountry2 = Integer.parseInt(convertStringToHex(strCountry2), 16);  
		int intCountry3 = Integer.parseInt(convertStringToHex(strCountry3), 16);  	
		
		for(int i = 196; i < 200; i++)
			update_packet[i] = (byte)(0XFF&(intCountry1>>(1919-i)*8));
		
		for(int i = 200; i < 204; i++)
			update_packet[i] = (byte)(0XFF&(intCountry2>>(1919-i)*8));
		
		for(int i = 204; i < 208; i++)
			update_packet[i] = (byte)(0XFF&(intCountry3>>(1919-i)*8));
		      
    }

    void setSpinSNS(String spinsns){
    	
    	String strSpinSNS1 = " ";
    	String strSpinSNS2 = " ";
		
		if(spinsns.length() <= 4){
			strSpinSNS1 = spinsns.substring(0, spinsns.length());
			strSpinSNS2 = " ";
		} else if(spinsns.length() > 4){
			strSpinSNS1 = spinsns.substring(0, 4);
			strSpinSNS2 = spinsns.substring(4, spinsns.length());
		}
    	
		int intSpinSNS1 = Integer.parseInt(convertStringToHex(strSpinSNS1), 16);  
		int intSpinSNS2 = Integer.parseInt(convertStringToHex(strSpinSNS2), 16); 
		
		for(int i = 208; i < 212; i++)
			update_packet[i] = (byte)(0XFF&(intSpinSNS1>>(1919-i)*8));
		
		for(int i = 212; i < 216; i++)
			update_packet[i] = (byte)(0XFF&(intSpinSNS2>>(1919-i)*8));
		
    }

    void setSNS(String sns){
    	
    	String strSNS1 = " ";
    	String strSNS2 = " ";
    	String strSNS3 = " ";
    	String strSNS4 = " ";
    	String strSNS5 = " ";
    			
		if(sns.length() <= 4){
			strSNS1 = sns.substring(0, sns.length());
			strSNS2 = " ";
			strSNS3 = " ";
			strSNS4 = " ";
			strSNS5 = " ";
		} else if( (sns.length()<=8) && (sns.length()> 4) ){
			strSNS1 = sns.substring(0, 4);
			strSNS2 = sns.substring(4, sns.length());
			strSNS3 = " ";
			strSNS4 = " ";
			strSNS5 = " ";
		} else if ((sns.length()<=12) && (sns.length() > 8)){
			strSNS1 = sns.substring(0, 4);
			strSNS2 = sns.substring(4, 8);
			strSNS3 = sns.substring(8, sns.length());
			strSNS4 = " ";
			strSNS5 = " ";
		} else if ((sns.length()<=16) && (sns.length() > 12)){
			strSNS1 = sns.substring(0, 4);
			strSNS2 = sns.substring(4, 8);
			strSNS3 = sns.substring(8, 12);
			strSNS4 = sns.substring(12, sns.length());
			strSNS5 = " ";
		} else if ((sns.length()<=20) && (sns.length() > 16)){
			strSNS1 = sns.substring(0, 4);
			strSNS2 = sns.substring(4, 8);
			strSNS3 = sns.substring(8, 12);
			strSNS4 = sns.substring(12, 16);	
			strSNS5 = sns.substring(16, sns.length());
		}
		
		int intSNS1 = Integer.parseInt(convertStringToHex(strSNS1), 16); 
		int intSNS2 = Integer.parseInt(convertStringToHex(strSNS2), 16); 
		int intSNS3 = Integer.parseInt(convertStringToHex(strSNS3), 16); 
		int intSNS4 = Integer.parseInt(convertStringToHex(strSNS4), 16); 
		int intSNS5 = Integer.parseInt(convertStringToHex(strSNS5), 16); 
			
		for(int i = 216; i < 220; i++)
			update_packet[i] = (byte)(0XFF&(intSNS1>>(1919-i)*8));
		
		for(int i = 220; i < 224; i++)
			update_packet[i] = (byte)(0XFF&(intSNS2>>(1919-i)*8));
		
		for(int i = 224; i < 228; i++)
			update_packet[i] = (byte)(0XFF&(intSNS3>>(1919-i)*8));
		
		for(int i = 228; i < 232; i++)
			update_packet[i] = (byte)(0XFF&(intSNS4>>(1919-i)*8));
		
		for(int i = 232; i < 236; i++)
			update_packet[i] = (byte)(0XFF&(intSNS5>>(1919-i)*8));
			
    }

    void setSpinOrg1(String spinorg1){
    	
    	String strSpinOrg1_1 = " ";
    	String strSpinOrg1_2 = " ";
		
		if(spinorg1.length() <= 4){
			strSpinOrg1_1 = spinorg1.substring(0, spinorg1.length());
			strSpinOrg1_2 = " ";
		} else if(spinorg1.length() > 4){
			strSpinOrg1_1 = spinorg1.substring(0, 4);
			strSpinOrg1_2 = spinorg1.substring(4, spinorg1.length());
		}
	
		int intSpinOrg1_1 = Integer.parseInt(convertStringToHex(strSpinOrg1_1), 16); 
		int intSpinOrg1_2 = Integer.parseInt(convertStringToHex(strSpinOrg1_2), 16);
		
		for(int i = 236; i < 240; i++)
			update_packet[i] = (byte)(0XFF&(intSpinOrg1_1>>(1919-i)*8));
		
		for(int i = 240; i < 244; i++)
			update_packet[i] = (byte)(0XFF&(intSpinOrg1_2>>(1919-i)*8));
		        
    }

    void setOrg1(String org1){
    	
    	String strOrg1_1 = " ";
    	String strOrg1_2 = " ";
    	String strOrg1_3 = " ";
    	
		if(org1.length() <= 4){
			strOrg1_1 = org1.substring(0, org1.length());
			strOrg1_2 = " ";
			strOrg1_3 = " ";
		} else if( (org1.length()<=8) && (org1.length()> 4) ){
			strOrg1_1 = org1.substring(0, 4);
			strOrg1_2 = org1.substring(4, org1.length());
			strOrg1_3 = " ";
		} else if (org1.length() > 8){
			strOrg1_1 = org1.substring(0, 4);
			strOrg1_2 = org1.substring(4, 8);
			strOrg1_3 = org1.substring(8, org1.length());
		}
		
		int intOrg1_1 = Integer.parseInt(convertStringToHex(strOrg1_1), 16); 
		int intOrg1_2 = Integer.parseInt(convertStringToHex(strOrg1_2), 16);
		int intOrg1_3 = Integer.parseInt(convertStringToHex(strOrg1_3), 16);	
			
		for(int i = 244; i < 248; i++)
			update_packet[i] = (byte)(0XFF&(intOrg1_1>>(1919-i)*8));
		
		for(int i = 248; i < 252; i++)
			update_packet[i] = (byte)(0XFF&(intOrg1_2>>(1919-i)*8));
		
		for(int i = 252; i < 256; i++)
			update_packet[i] = (byte)(0XFF&(intOrg1_3>>(1919-i)*8));
		         
    }

    void setSpinOrg2(String spinorg2){
    	
    	String strSpinOrg2_1 = " ";
    	String strSpinOrg2_2 = " ";
    	
		if(spinorg2.length() <= 4){
			strSpinOrg2_1 = spinorg2.substring(0, spinorg2.length());
			strSpinOrg2_2 = " ";
		} else if(spinorg2.length() > 4){
			strSpinOrg2_1 = spinorg2.substring(0, 4);
			strSpinOrg2_2 = spinorg2.substring(4, spinorg2.length());
		}
	
		int intSpinOrg2_1 = Integer.parseInt(convertStringToHex(strSpinOrg2_1), 16); 
		int intSpinOrg2_2 = Integer.parseInt(convertStringToHex(strSpinOrg2_2), 16); 		
		
		for(int i = 256; i < 260; i++)
			update_packet[i] = (byte)(0XFF&(intSpinOrg2_1>>(1919-i)*8));
		
		for(int i = 260; i < 264; i++)
			update_packet[i] = (byte)(0XFF&(intSpinOrg2_2>>(1919-i)*8));
		
    }

    void setOrg2(String org2){
    	
    	String strOrg2_1 = " ";
    	String strOrg2_2 = " ";
    	String strOrg2_3 = " ";
    	
		if(org2.length() <= 4){
			strOrg2_1 = org2.substring(0, org2.length());
			strOrg2_2 = " ";
			strOrg2_3 = " ";
		} else if( (org2.length()<=8) && (org2.length()> 4) ){
			strOrg2_1 = org2.substring(0, 4);
			strOrg2_2 = org2.substring(4, org2.length());
			strOrg2_3 = " ";
		} else if (org2.length() > 8){
			strOrg2_1 = org2.substring(0, 4);
			strOrg2_2 = org2.substring(4, 8);
			strOrg2_3 = org2.substring(8, org2.length());
		}
    	
		int intOrg2_1 = Integer.parseInt(convertStringToHex(strOrg2_1), 16); 
		int intOrg2_2 = Integer.parseInt(convertStringToHex(strOrg2_2), 16);
		int intOrg2_3 = Integer.parseInt(convertStringToHex(strOrg2_3), 16);
		
		for(int i = 264; i < 268; i++)
			update_packet[i] = (byte)(0XFF&(intOrg2_1>>(1919-i)*8));
		
		for(int i = 268; i < 272; i++)
			update_packet[i] = (byte)(0XFF&(intOrg2_2>>(1919-i)*8));
		
		for(int i = 272; i < 276; i++)
			update_packet[i] = (byte)(0XFF&(intOrg2_3>>(1919-i)*8));
		    	
    }
    
    void setNotes(String notes){

    	String strNotes1 = " ";
    	String strNotes2 = " ";
    	String strNotes3 = " ";
    	String strNotes4 = " ";
    	String strNotes5 = " ";
    	
		if(notes.length() <= 4){
			strNotes1 = notes.substring(0, notes.length());
			strNotes2 = " ";
			strNotes3 = " ";
			strNotes4 = " ";
			strNotes5 = " ";
		} else if( (notes.length()<=8) && (notes.length()> 4) ){
			strNotes1 = notes.substring(0, 4);
			strNotes2 = notes.substring(4, notes.length());
			strNotes3 = " ";
			strNotes4 = " ";
			strNotes5 = " ";
		} else if ((notes.length()<=12) && (notes.length() > 8)){
			strNotes1 = notes.substring(0, 4);
			strNotes2 = notes.substring(4, 8);
			strNotes3 = notes.substring(8, notes.length());
			strNotes4 = " ";
			strNotes5 = " ";
		} else if ((notes.length()<=16) && (notes.length() > 12)){
			strNotes1 = notes.substring(0, 4);
			strNotes2 = notes.substring(4, 8);
			strNotes3 = notes.substring(8, 12);
			strNotes4 = notes.substring(12, notes.length());
			strNotes5 = " ";
		} else if ((notes.length()<=20) && (notes.length() > 16)){
			strNotes1 = notes.substring(0, 4);
			strNotes2 = notes.substring(4, 8);
			strNotes3 = notes.substring(8, 12);
			strNotes4 = notes.substring(12, 16);	
			strNotes5 = notes.substring(16, notes.length());
		}
		
    	int intNotes1 = Integer.parseInt(convertStringToHex(strNotes1), 16); 
		int intNotes2 = Integer.parseInt(convertStringToHex(strNotes2), 16); 
		int intNotes3 = Integer.parseInt(convertStringToHex(strNotes3), 16); 
		int intNotes4 = Integer.parseInt(convertStringToHex(strNotes4), 16); 
		int intNotes5 = Integer.parseInt(convertStringToHex(strNotes5), 16); 
    	
		for(int i = 276; i < 280; i++)
			update_packet[i] = (byte)(0XFF&(intNotes1>>(1919-i)*8));
		
		for(int i = 280; i < 284; i++)
			update_packet[i] = (byte)(0XFF&(intNotes2>>(1919-i)*8));
		
		for(int i = 284; i < 288; i++)
			update_packet[i] = (byte)(0XFF&(intNotes3>>(1919-i)*8));
		
		for(int i = 288; i < 292; i++)
			update_packet[i] = (byte)(0XFF&(intNotes4>>(1919-i)*8));
		
		for(int i = 292; i < 296; i++)
			update_packet[i] = (byte)(0XFF&(intNotes5>>(1919-i)*8));
		      
    }
     
    void setTime(String time){
    	
    	String strTime1 = " ";
    	String strTime2 = " ";
    	String strTime3 = " ";
    	String strTime4 = " ";
    	
		if(time.length() <= 4){
			strTime1 = time.substring(0, time.length());
			strTime2 = " ";
			strTime3 = " ";
			strTime4 = " ";
		} else if( (time.length()<=8) && (time.length()> 4) ){
			strTime1 = time.substring(0, 4);
			strTime2 = time.substring(4, time.length());
			strTime3 = " ";
			strTime4 = " ";
		} else if ((time.length()<=12) && (time.length() > 8)){
			strTime1 = time.substring(0, 4);
			strTime2 = time.substring(4, 8);
			strTime3 = time.substring(8, time.length());
			strTime4 = " ";
		} else if ((time.length()<=16) && (time.length() > 12)){
			strTime1 = time.substring(0, 4);
			strTime2 = time.substring(4, 8);
			strTime3 = time.substring(8, 12);
			strTime4 = time.substring(12, time.length());	
		}
					
		int intTime1 = Integer.parseInt(convertStringToHex(strTime1), 16); 
		int intTime2 = Integer.parseInt(convertStringToHex(strTime2), 16); 
		int intTime3 = Integer.parseInt(convertStringToHex(strTime3), 16); 
		int intTime4 = Integer.parseInt(convertStringToHex(strTime4), 16); 
		
		for(int i = 296; i < 300; i++)
			update_packet[i] = (byte)(0XFF&(intTime1>>(1919-i)*8));
		
		for(int i = 300; i < 304; i++)
			update_packet[i] = (byte)(0XFF&(intTime2>>(1919-i)*8));
		
		for(int i = 304; i < 308; i++)
			update_packet[i] = (byte)(0XFF&(intTime3>>(1919-i)*8));
		
		for(int i = 308; i < 312; i++)
			update_packet[i] = (byte)(0XFF&(intTime4>>(1919-i)*8));
		
    }

    void setPhotoSize(String strSize){
    	
        int intSize = Integer.parseInt(convertStringToHex(strSize), 16);	
				
		for(int i = 312; i < 316; i++)
			update_packet[i] = (byte)(0XFF&(intSize>>(1919-i)*8)); 

    }
    
    void setOwner(String owner){
		
		int intOwner = Integer.parseInt(convertStringToHex(owner), 16);	

		for(int i = 316; i < 320; i++)
			update_packet[i] = (byte)(0XFF&(intOwner>>(1919-i)*8)); 
		      
	}

	void setPhoto(byte[] photo){

		for(int i = 320; i < photo_length+320; i++) 		
    		update_packet[i] = photo[i-320];
		
		for(int i = photo_length+320; i < 1920; i++)
			update_packet[i] = 0;
			
    }

    String convertStringToHex(String str){
    	
    	char[] chars = str.toCharArray();
		StringBuffer hex = new StringBuffer();
		
		for(int i = 0; i < chars.length; i++){
		    hex.append(Integer.toHexString((int)chars[i]));
		}
	 
		return hex.toString();
	}

    public static String convertHexToString(String hex){
		 
		  StringBuilder sb = new StringBuilder();
		  StringBuilder temp = new StringBuilder();
	 		  
		  for( int i=0; i<hex.length()-1; i+=2 ){
		      //grab the hex in pairs
		      String output = hex.substring(i, (i + 2));
		      //convert hex to decimal
		      int decimal = Integer.parseInt(output, 16);
		      //convert the decimal to character
		      sb.append((char)decimal);
	 
		      temp.append(decimal);
		  }
		  		  
		  return sb.toString();
	  } 
}